const {createPool} = require('mysql2/promise');
require('dotenv').config();
// 创建数据库连接池
const pool = createPool({
    host: process.env.DB_HOST,
    user: process.env.DB_USER,
    password: process.env.DB_PASSWORD,
    database: 'shop', // 数据库名称
    port: process.env.DB_PORT,
    waitForConnections: true, // 等待连接池连接
    connectionLimit: 10, // 连接池连接数量限制
});

// 导出数据库连接池
module.exports = pool;